<?php

    class PANDORA_Prototipos_Upload
    {
        protected $form;
        
        public function __construct($destinationUrl)
        {
            $this->form = new Zend_Form();
            
            
            $upload = new Zend_Form_Element_File('uploadedfile');
            $upload->setLabel('Enviar arquivo:')
               ->setDestination('../public/db/user/photo');
            $upload->addValidator('Count', false, 1)
                    ->addValidator('Extension', false, 'jpg,png,gif')
                    ->setRequired(true);

            $grupo = new Zend_Form_Element_Select('grupo');
            $grupo->setLabel('Grupo: ')
                  ->addMultiOptions(array
                    (
                    'empresa' => 'Foto de Perfil',
                    'trabalhos' => 'Fotos de Album'
                    ));

            $description = $this->form->createElement('text','descricao',array('label'=>'Descricao'));
            $description->addValidator('alnum');

            $this->form->addElement($description);
            $this->form->addElement($grupo);
            $this->form->addElement($upload, 'upload');
            $this->form->addElement('submit','logar',array('label' => 'UpLoad'));

            echo $this->form;
        }
        
        public function dataValidation($data)
        {
            if($this->form->isValid($data))
            return true;
            
            return false;
            
        }
        
        public function getValues()
        {
           return $this->form->getValues();
        }
           
               
    }